package leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2021-12-19 10:42
 **/
public class LeetCode5958 {

    public long getDescentPeriods(int[] prices) {
        long count = 0;
        for (int i = 0, j = 0; i < prices.length; i++) {
            count += j = i > 0 && prices[i] == prices[i - 1] - 1 ? ++j : 1;
        }
        return count;
    }

    public static void main(String[] args) {
        LeetCode5958 code = new LeetCode5958();
        System.out.println(code.getDescentPeriods(new int[]{3,2,1,4}));
        System.out.println(code.getDescentPeriods(new int[]{8,7,7,6}));
        System.out.println(code.getDescentPeriods(new int[]{1}));
        System.out.println(code.getDescentPeriods(new int[]{12,11,10,9,8,7,6,5,4,3,4,3,10,9,8,7}));
        System.out.println(code.getDescentPeriods(new int[]{4,3,2,1}));
    }


}
